package com.lunesu.bjair;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

class HttpHelpers {
	
	static BufferedReader openUrl(String url) throws IOException
	{
		HttpClient httpconn = new DefaultHttpClient();
		HttpResponse resp = httpconn.execute(new HttpGet(url));
		HttpEntity httpent = resp.getEntity();
		//String encoding = httpent.getContentEncoding().getValue();
		// FIXME: use encoding, if available
		return new BufferedReader(new InputStreamReader(httpent.getContent()));
	}
	
}
